package com.ja.openchat.viewmodels;

import android.app.Application;
import android.os.Bundle;

import androidx.annotation.NonNull;
import androidx.databinding.ObservableField;

import me.goldze.mvvmhabit.base.BaseViewModel;
import me.goldze.mvvmhabit.binding.command.BindingAction;
import me.goldze.mvvmhabit.binding.command.BindingCommand;
import me.goldze.mvvmhabit.bus.Messenger;


public class SetPwdSuccessViewModel extends BaseViewModel {
    public ObservableField<String> success = new ObservableField<>("您已设置新的支付密码");

    public SetPwdSuccessViewModel(@NonNull Application application) {
        super(application);
        Messenger.getDefault().sendNoMsg(SetPayPwdOldViewModel.TOKEN_SETPAYPWDOLDVIEWMODEL_FINISH);
        Messenger.getDefault().sendNoMsg(SetPayPwdViewModel.TOKEN_SETPAYPWDVIEWMODEL_FINISH);
        Messenger.getDefault().sendNoMsg(SetPayPwdConfirmViewModel.TOKEN_SETPAYPWDCONFIRMVIEWMODEL_FINISH);
    }

    //提交按钮的点击事件
    public BindingCommand confirmOnClickCommand = new BindingCommand(new BindingAction() {
        @Override
        public void call() {
            finish();
        }
    });

    public void setData(Bundle bundle) {
        if (bundle != null) {
            success.set(bundle.getString("success"));
        }
    }
}
